Disk drives employ a cache, made of semiconductor memory, to increase performance. A host computer sends read and write commands through an interface, such as the Small Computer System Interface (SCSI), to the disk drive. The disk drive stores data to be written on the disk or data read from the disk in the cache. A cache hit occurs when the cache contains data requested in a read command. The disk drive can then provide the requested data from the cache without incurring mechanical delays.
In SCSI, the host computer is known as the initiator and the disk drive is known as the target. The initiator sends a command to the target and the target must determine what appropriate action to take based on the type of command. SCSI commands are communicated by sending a command descriptor block during a command phase. SCSI supports a number of commands including data transfer request commands. Data transfer requests include a read command, a read extended command, a write command, and a write extended command. One of the SCSI commands formats the drive medium into initiator addressable logical blocks. Each logical block has a logical block address (LBA).
The logical block address, LBA, uniquely references the location of data on the disk drive. Data transfer requests include the starting LBA of the data to be read or written and the number of logical blocks to continue to read or write and the length of the read or write. When two commands refer to a contiguous range of LBAs, the disk drive designates one command to be sequential with the other command. For example, a second command having a starting LBA of 1024 with a length of 256 logical blocks would be sequential to a first command with a starting LBA of 512 with a length of 512 logical blocks. When a second command does not refer to a sequential range of LBAs, the disk drive may designate the second command as a non-sequential command. Non-sequential commands include random commands and series of commands whose total block length is relatively small.
The structure of the cache affects disk drive performance. To increase performance, the cache may be divided into smaller units called segments. These segments store data that have boundaries associated with fixed or variable LBA address ranges.
One method of the prior art uses fixed sized segments. When a request arrives, an entire segment of the cache is allocated to the request regardless of its length. The allocation of an entire segment to a non-sequential command wastes the unused portion of the segment. Additionally in these cases, the disk drive must flush the previously stored data from the segment which reduces the probability of cache hits occurring for subsequent requests.
What is needed in the art is a way of making more efficient use of cache segments.